<!DOCTYPE html>
<html>

{include file='public/header'}
<style>
    .layui-form-label{
        padding: 9px 12px;
    }
</style>
<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="javascript:void(0)">首页</a>
            <a href="javascript:void(0)">活动管理</a>
            <a><cite>活动统计</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" id="reload" title="刷新">
            <i class="layui-icon" style="line-height:30px"><i class="iconfont">&#xe6aa;</i></i>
        </a>
    </div>
    <div class="x-body">
        <form class="layui-form layui-row" style="margin-top:15px;margin-bottom: 10px;">
            <div class="layui-inline">
                <label class="layui-form-label w-auto">选择活动：</label>
                <div id="PActivityId" style="width:100%;flex:1"></div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label w-auto">选择小程序：</label>
                <div id="PAppletId" style="width:100%;flex:1"></div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label w-auto">平台类型：</label>
                <div class="layui-input-inline" style="width:182px">
                    <select name="platform_type" id="platform_type">
                        <option value="">请选择</option>
                        <option value="1">微信小程序</option>
                        <option value="2">抖音小程序</option>
                        <option value="3">快手小程序</option>
                    </select>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label w-auto">时间：</label>
                <div class="layui-inline" id="time" style="display: flex;
                    ">
                    <div class="layui-input-inline" style="margin-right:10px">
                        <input type="text" autocomplete="off" name="date" id="date" class="layui-input"
                               placeholder="选择日期">
                    </div>
                </div>
            </div>
            <div class="layui-inline" style="margin-left:10px">
                <button class="layui-btn" lay-submit lay-filter="searchList">搜索</button>
                <button type="reset" id="resetList" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </form>

        <table id="statistics_list" lay-filter="statistics_list"></table>
    </div>
    <script>
        let params = {
            elem: '#statistics_list'
            , toolbar: '#toolbarDemo'
            , url: '/admin/activity/statisticsList' //数据接口
            , id: 'statistics_list'
            , limit:15
            , page:true
            , cols: [[ //表头
                { field: 'id', title: 'ID', width: 80, sort: true, align:'center', width:90}
                , { field: 'date', title: '时间', align:'center', width:120}
                , { field: 'applet_name', title: '小程序名称', align:'center', width:100}
                , { field: 'activity_name', title: '活动名称', align:'center', width:200}
                , { field: 'activity_type', title: '活动类型', align:'center', width:100}
                , { field: 'click_count', title: '点击次数<i class="layui-icon iconfont icon-lytishi1" id="click_count"></i>', align:'center'}
                , { field: 'click_uv', title: '点击人数', align:'center'}
                , { field: 'recharge_uv', title: '充值人数', align:'center'}
                , { field: 'recharge_count', title: '充值次数', align:'center'}
                , { field: 'recharge_amount', title: '充值金额', align:'center'}
                , { field: 'refund_amount', title: '退款金额', align:'center'}
                , { field: 'arpu', title: 'ARPU<i class="layui-icon iconfont icon-lytishi1" id="arpu"></i>', align:'center'}
            ]]
            , done:function(){
                tips('#arpu','#arpu','点击人数的付费情况。充值金额/点击人数')
                tips('#click_count','#click_count','点击立即充值的次数')
            }
        }
        tableList(params)

        let selectActivity = {
            url: '/admin/activity/select',
            selected: [],
            tips: '请选择',
            name: 'activity_id',
            field_id: 'id',
            field_Name: 'name',
            elem: '#PActivityId'
        }
        selectN(selectActivity)

        let selectApplet = {
            url: '/admin/applet/select',
            selected: [],
            tips: '请选择',
            name: 'applet_id',
            field_id: 'id',
            field_Name: 'name',
            elem: '#PAppletId'
        }
        selectN(selectApplet)

        layui.use('laydate', function(){
            var layDate = layui.laydate;
            layDate.render({
                elem: '#date',
                type: 'date'
            });
        })


    </script>
</body>

</html>